#! /usr/bin/env python3

"""
A script to create the mean.

2019-3-23 by Stone at GDOU-KC
"""
import requests
import json

# ===== ===== ===== ===== =====
# Constants
# ===== ===== ===== ===== =====
# the url to create the menu
URL = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=19_DhT5VKjMeLW3_16LEwm1W1tZlIjcsRJCrB6ncYJFJ3dwzPytEWULTlI3y8Ww3EwEMjrbhRKod3-WWj64hwHDRLLfqajG3P7EXClBWxrOqplXxxrg1kLDR9pxyeliWQzud67BhrF9yCjicWeiBOOeAJAHUU'

# the json structure that defines the menu of wechat Official Account
MENU = {
    "button": [
        {
            "type": "view",
            "name": "船模报名",
            "url": "cn.bing.com",
            "key": "sign up"
        }
    ]
}


# ===== ===== ===== ===== =====
# Main
# ===== ===== ===== ===== =====
if __name__ == "__main__":
    menu = json.dumps(MENU)
    reqt = requests.post(URL, menu)

    print("\r\nresponse: %s" % reqt.content)

